﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CBMS.Interfaces;
using CBMS.Business;
using CBMS.Resources;
using CBMS.Objects;

namespace CBMS
{
    public partial class frmMainNormal : Form
    {
        public static IEmployeeRepository empRes { get; set; }

        public frmMainNormal()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                this.Text = Views.SystemName;
                empRes = new EmployeeRepository();
                var lstEmp = empRes.List();
                lblCount.Text = lstEmp.Count().ToString();
                dgvEmployees.DataSource = lstEmp;
                int toTal = 0;
                var lstObject = empRes.SearchEmployeesBySomeCondition(" where 1=1", 1, 20, string.Empty, string.Empty,ref toTal);
                dgvEmployeeStore.DataSource = lstObject;
            }
            catch(Exception ex)
            {
                lblCount.Text = ex.Message;
            }
        }
    }
}
